<?php
namespace LPCISII\PHP2012Bundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use LPCISII\PHP2012Bundle\Entity\Categories;

use Doctrine\Common\Persistence\ObjectManager;

class CategoriesFixtures extends AbstractFixture implements OrderedFixtureInterface {

    public function load(ObjectManager $manager) {
        $categorie = new Categories();
        $categorie->setNom('Informatique');
        $manager->persist($categorie);
        
        $categorie2 = new Categories();
        $categorie2->setNom('Livres');
        $manager->persist($categorie2);
        
        $categorie3 = new Categories();
        $categorie3->setNom('Musique');
        $manager->persist($categorie3);
        
        $categorie4 = new Categories();
        $categorie4->setNom('Véhicule');
        $manager->persist($categorie4);
        
        $manager->flush();
        
        $this->addReference('Informatique', $categorie);
        $this->addReference('Livres', $categorie2);
        $this->addReference('Musique', $categorie3);
        $this->addReference('Véhicule', $categorie4);
    }

    public function getOrder() {
        return 2;
    }
}